package org.example.controller;

import org.elasticsearch.client.RestHighLevelClient;
import org.example.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private RestHighLevelClient client;

    @Autowired
    private RedisTemplate redisTemplate;

    @RequestMapping("/test")
    @ResponseBody
    public String test(@RequestBody User user) {
        redisTemplate.opsForValue().set("username", user.getName());
        System.out.println(redisTemplate.opsForValue().get("username"));
        return redisTemplate.opsForValue().get("username").toString();
    }
}
